#include "config_main.h"
#ifdef DDENN_LOCAL_TIME
/*
 * local_time.c
 *
 *  Created on: 06.06.2009
 *      Author: Admin
 */

#include "local_time.h"

/**************************************************************************************/
//
//          it provides ddenn/time/local_time_hours,minutes,seconds
//
/*************************************************************************************/


void DdennLocalTime::RegisterDdennLocalTime(){
	XPLMRegisterDataAccessor( "ddenn/time/local_time_hours" ,    xplmType_Int, 1,
		                                   GetLocalTimeHours,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,  NULL,NULL,    NULL,  NULL,NULL);
	XPLMRegisterDataAccessor( "ddenn/time/local_time_minutes" ,    xplmType_Int, 1,
									   GetLocalTimeMinutes,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,  NULL,NULL,    NULL,  NULL,NULL);
	XPLMRegisterDataAccessor( "ddenn/time/local_time_seconds" ,    xplmType_Int, 1,
									   GetLocalTimeSeconds,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,  NULL,NULL,    NULL,  NULL,NULL);


}

void DdennLocalTime::UnregisterDdennLocalTime(){

	XPLMUnregisterDataAccessor( XPLMFindDataRef( "ddenn/time/local_time_hours"));
	XPLMUnregisterDataAccessor(  XPLMFindDataRef("ddenn/time/local_time_minutes"));
	XPLMUnregisterDataAccessor( XPLMFindDataRef( "ddenn/time/local_time_seconds" ));


}




int DdennLocalTime::GetLocalTimeHours ( void *               inRefcon)
{

	return UTCTimeToHours(GetDataRefF("sim/time/local_time_sec"));
}

int DdennLocalTime::GetLocalTimeMinutes ( void *               inRefcon)
{
	return UTCTimeToMinutes(GetDataRefF("sim/time/local_time_sec"));

}

int DdennLocalTime::GetLocalTimeSeconds ( void *               inRefcon)
{
	return UTCTimeToSeconds(GetDataRefF("sim/time/local_time_sec"));

}




/**************************************************************************************/
//
//          end of ddenn/time/local_time_hours,minutes,seconds
//
/*************************************************************************************/


#endif
